fix clazy detected 'Use *Ref() instead'
authortsteven4 <tsteven4@gmail.com>
Tue, 13 Nov 2018 15:30:46 +0000 (08:30 -0700)
committertsteven4 <tsteven4@gmail.com>
Tue, 13 Nov 2018 15:30:46 +0000 (08:30 -0700)
These are from -Wclazy-qstring-ref, and were automatically fixed.

defs.h
garmin_tables.cc
maggeo.cc
pcx.cc

diff --git a/defs.h b/defs.h
index 0ab96ff0f6fd837a5ce9ed528c8622cb8294064e..4ea3ac1b9a73ffd3260c0a62eb0d07f37ad71f7f 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -1062,7 +1062,7 @@ case_ignore_strcmp(const QString& s1, const QString& s2)
 // In 95% of the callers, this could be s1.startsWith(s2)...
 inline int case_ignore_strncmp(const QString& s1, const QString& s2, int n)
 {
-  return s1.left(n).compare(s2.left(n), Qt::CaseInsensitive);
+  return s1.leftRef(n).compare(s2.left(n), Qt::CaseInsensitive);
 }
 
 int str_match(const char* str, const char* match);
index a8241bb1ab1cc1204e81c38db8f41ef242840bfd..40725087d9198aeabcbcdb23db1bf4fa9accdd52 100644 (file)
@@ -798,7 +798,7 @@ int gt_find_icon_number_from_desc(const QString& desc, garmin_formats_e garmin_f
       base = 7680;
     }
     if (base) {
-      n = desc.mid(7).toInt();
+      n = desc.midRef(7).toInt();
       return n + base;
     }
   }
index 10f1b065fd246f5b056b79e2c859200160f7f27b..00ad4cc608c78d6b92de6b058bf77dddc285778b 100644 (file)
--- a/maggeo.cc
+++ b/maggeo.cc
@@ -192,9 +192,9 @@ maggeo_fmtdate(const QDateTime& dt)
 static QDateTime maggeo_parsedate(char* dmy)
 {
   QString date(dmy);
-  int d = date.mid(0,2).toInt();
-  int m = date.mid(2,2).toInt();
-  int y = date.mid(4,3).toInt();
+  int d = date.midRef(0,2).toInt();
+  int m = date.midRef(2,2).toInt();
+  int y = date.midRef(4,3).toInt();
   QDateTime r(QDate(y + 1900, m, d));
   return r;
 }
diff --git a/pcx.cc b/pcx.cc
index 677c233fca2d8732947ed58c784c0c611fbca674..93ad8569196e6bf7e5332fa165133c4f07940e99 100644 (file)
--- a/pcx.cc
+++ b/pcx.cc
@@ -168,8 +168,8 @@ static void data_read() {
           wpt_tmp->longitude = lon;
           wpt_tmp->latitude = lat;
         } else {
-          lat = tbuf.mid(1, -1).toDouble();
-          lon = nbuf.mid(1, -1).toDouble();
+          lat = tbuf.midRef(1, -1).toDouble();
+          lon = nbuf.midRef(1, -1).toDouble();
           if (tbuf[0] == 'S') {
             lat = -lat;
           }
@@ -241,8 +241,8 @@ static void data_read() {
           wpt_tmp->longitude = lon;
           wpt_tmp->latitude = lat;
         } else {
-          lat = tbuf.mid(1, -1).toDouble();
-          lon = nbuf.mid(1, -1).toDouble();
+          lat = tbuf.midRef(1, -1).toDouble();
+          lon = nbuf.midRef(1, -1).toDouble();
           if (tbuf[0] == 'S') {
             lat = -lat;
           }